﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
//using Microsoft.DirectX.AudioVideoPlayback;

namespace Game
{
    partial class Main
    {
        private void shw_NewGameDialog()
        {
            this.Controls.Clear();
            this.BackgroundImage = global::Game.Properties.Resources.new_game_bg;
            this.Controls.Add(this.Name_bx);
            this.Controls.Add(this.startGame_bttn);
        }
        private void shw_MainDialog()
        {
            this.Controls.Clear();
            this.BackgroundImage = global::Game.Properties.Resources.start_bg;
            this.Controls.Add(this.newGame_bttn);
            this.Controls.Add(this.Settinngs_bttn);
            this.Controls.Add(this.Exit_bttn);
        }
        private void shw_SettingsDialog()
        {
            this.Controls.Clear();
            this.BackgroundImage = global::Game.Properties.Resources.settings_bg;
            this.Controls.Add(this.settingsDifficulty_lbttn);
            this.Controls.Add(this.settingsDifficulty_rbttn);
            this.Controls.Add(this.settingsGraphic_lbttn);
            this.Controls.Add(this.settingsGraphic_rbttn);
            this.Controls.Add(this.settingsSound_rbttn);
            this.Controls.Add(this.settingsSound_lbttn);
            this.Controls.Add(this.settingsCancel_bttn);
            this.Controls.Add(this.settingsSave_bttn);
            this.Controls.Add(this.settingsDifficulty_img);
            this.Controls.Add(this.settingsGraphic_img);
            this.Controls.Add(this.settingsSound_img);
        }
        private void crt_MouseHandlers()
        {
            this.newGame_bttn.MouseEnter += new System.EventHandler(this.newGame_bttn_MouseEnter);
            this.newGame_bttn.MouseLeave += new System.EventHandler(this.newGame_bttn_MouseLeave);
            this.newGame_bttn.MouseHover += new System.EventHandler(this.newGame_bttn_MouseHover);

            this.Settinngs_bttn.MouseEnter += new System.EventHandler(this.Settinngs_bttn_MouseEnter);
            this.Settinngs_bttn.MouseLeave += new System.EventHandler(this.Settinngs_bttn_MouseLeave);
            this.Settinngs_bttn.MouseHover += new System.EventHandler(this.Settinngs_bttn_MouseHover);

            this.Exit_bttn.MouseEnter += new System.EventHandler(this.Exit_bttn_MouseEnter);
            this.Exit_bttn.MouseLeave += new System.EventHandler(this.Exit_bttn_MouseLeave);
            this.Exit_bttn.MouseHover += new System.EventHandler(this.Exit_bttn_MouseHover);

            this.startGame_bttn.MouseEnter += new System.EventHandler(this.startGame_bttn_MouseEnter);
            this.startGame_bttn.MouseLeave += new System.EventHandler(this.startGame_bttn_MouseLeave);
            this.startGame_bttn.MouseHover += new System.EventHandler(this.startGame_bttn_MouseHover);

            this.settingsSave_bttn.MouseEnter += new System.EventHandler(this.settingsSave_bttn_MouseEnter);
            this.settingsSave_bttn.MouseLeave += new System.EventHandler(this.settingsSave_bttn_MouseLeave);
            this.settingsSave_bttn.MouseHover += new System.EventHandler(this.settingsSave_bttn_MouseHover);
            this.settingsSave_bttn.Click += new EventHandler(settingsSave_bttn_Click);

            this.settingsCancel_bttn.MouseEnter += new System.EventHandler(this.settingsCancel_bttn_MouseEnter);
            this.settingsCancel_bttn.MouseLeave += new System.EventHandler(this.settingsCancel_bttn_MouseLeave);
            this.settingsCancel_bttn.MouseHover += new System.EventHandler(this.settingsCancel_bttn_MouseHover);
            this.settingsCancel_bttn.Click += new EventHandler(settingsCancel_bttn_Click);

            this.settingsDifficulty_lbttn.MouseEnter += new System.EventHandler(settingsDifficulty_lbttn_MouseEnter);
            this.settingsDifficulty_lbttn.MouseHover += new System.EventHandler(settingsDifficulty_lbttn_MouseHover);
            this.settingsDifficulty_lbttn.MouseLeave += new System.EventHandler(settingsDifficulty_lbttn_MouseLeave);
            this.settingsDifficulty_lbttn.Click += new EventHandler(settingsDifficulty_Click);

            this.settingsDifficulty_rbttn.MouseEnter += new EventHandler(settingsDifficulty_rbttn_MouseEnter);
            this.settingsDifficulty_rbttn.MouseHover += new EventHandler(settingsDifficulty_rbttn_MouseHover);
            this.settingsDifficulty_rbttn.MouseLeave += new EventHandler(settingsDifficulty_rbttn_MouseLeave);
            this.settingsDifficulty_rbttn.Click += new EventHandler(settingsDifficulty_Click);

            this.settingsGraphic_lbttn.MouseEnter += new EventHandler(settingsGraphic_lbttn_MouseEnter);
            this.settingsGraphic_lbttn.MouseHover += new EventHandler(settingsGraphic_lbttn_MouseHover);
            this.settingsGraphic_lbttn.MouseLeave += new EventHandler(settingsGraphic_lbttn_MouseLeave);
            this.settingsGraphic_lbttn.Click += new EventHandler(settingsGraphic_Click);

            this.settingsGraphic_rbttn.MouseEnter += new EventHandler(settingsGraphic_rbttn_MouseEnter);
            this.settingsGraphic_rbttn.MouseHover += new EventHandler(settingsGraphic_rbttn_MouseHover);
            this.settingsGraphic_rbttn.MouseLeave += new EventHandler(settingsGraphic_rbttn_MouseLeave);
            this.settingsGraphic_rbttn.Click += new EventHandler(settingsGraphic_Click);

            this.settingsSound_lbttn.MouseEnter += new EventHandler(settingsSound_lbttn_MouseEnter);
            this.settingsSound_lbttn.MouseHover += new EventHandler(settingsSound_lbttn_MouseHover);
            this.settingsSound_lbttn.MouseLeave += new EventHandler(settingsSound_lbttn_MouseLeave);
            this.settingsSound_lbttn.Click +=new EventHandler(settingsSound_Click);

            this.settingsSound_rbttn.MouseEnter += new EventHandler(settingsSound_rbttn_MouseEnter);
            this.settingsSound_rbttn.MouseHover += new EventHandler(settingsSound_rbttn_MouseHover);
            this.settingsSound_rbttn.MouseLeave += new EventHandler(settingsSound_rbttn_MouseLeave);
            this.settingsSound_rbttn.Click += new EventHandler(settingsSound_Click);

            this.KeyDown += new KeyEventHandler(Main_KeyUp);
        }

        void Main_KeyUp(object sender, KeyEventArgs e)
        {
            if (this.player != null)
            {
                if (e.KeyCode == System.Windows.Forms.Keys.NumPad4 || e.KeyCode == System.Windows.Forms.Keys.Left || e.KeyCode == System.Windows.Forms.Keys.A)
                {
                    if (this.game_over == false)
                    {
                        this.player.moveLeft(ref this.lb);
                        this.steps++;
                        this.drw_Player();
                    }
                }
                if (e.KeyCode == System.Windows.Forms.Keys.NumPad6 || e.KeyCode == System.Windows.Forms.Keys.Right || e.KeyCode == System.Windows.Forms.Keys.D)
                {
                    if (this.game_over == false)
                    {
                        this.player.moveRight(ref this.lb);
                        this.steps++;
                        this.drw_Player();
                    }
                }
                if (e.KeyCode == System.Windows.Forms.Keys.NumPad8 || e.KeyCode == System.Windows.Forms.Keys.Up || e.KeyCode == System.Windows.Forms.Keys.W)
                {
                    if (this.game_over == false)
                    {
                        this.player.moveUp(ref this.lb);
                        this.steps++;
                        this.drw_Player();
                    }
                }
                if (e.KeyCode == System.Windows.Forms.Keys.NumPad2 || e.KeyCode == System.Windows.Forms.Keys.Down || e.KeyCode == System.Windows.Forms.Keys.S)
                {
                    if (this.game_over == false)
                    {
                        this.player.moveDown(ref this.lb);
                        this.steps++;
                        this.drw_Player();
                    }
                }
                if (e.KeyCode == System.Windows.Forms.Keys.P)
                {
                    if (status == "on")
                    {
                        this.stopGame();
                        this.status = "pause";
                    }
                    else
                    {
                        this.continueGame();
                        this.status = "on";
                    }
                }
            }
        }



        private void crt_Form()
        {
            this.SuspendLayout();
            // 
            // newGame_bttn
            // 
            this.newGame_bttn.FlatAppearance.BorderSize = 0;
            this.newGame_bttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.newGame_bttn.Image = global::Game.Properties.Resources.new_game_button;
            this.newGame_bttn.Location = new System.Drawing.Point(254, 212);
            this.newGame_bttn.Name = "newGame_bttn";
            this.newGame_bttn.Size = new System.Drawing.Size(282, 77);
            this.newGame_bttn.TabIndex = 0;
            this.newGame_bttn.UseVisualStyleBackColor = true;
            this.newGame_bttn.Click += new System.EventHandler(this.newGame_bttn_Click);

            // 
            // Settinngs_bttn
            // 
            this.Settinngs_bttn.FlatAppearance.BorderSize = 0;
            this.Settinngs_bttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.Settinngs_bttn.Image = global::Game.Properties.Resources.settings_button;
            this.Settinngs_bttn.Location = new System.Drawing.Point(254, 288);
            this.Settinngs_bttn.Name = "Settinngs_bttn";
            this.Settinngs_bttn.Size = new System.Drawing.Size(282, 89);
            this.Settinngs_bttn.TabIndex = 1;
            this.Settinngs_bttn.UseVisualStyleBackColor = true;
            this.Settinngs_bttn.Click += new System.EventHandler(this.Settinngs_bttn_Click);
            // 
            // Exit_bttn
            // 
            this.Exit_bttn.FlatAppearance.BorderSize = 0;
            this.Exit_bttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.Exit_bttn.Image = global::Game.Properties.Resources.exit_button;
            this.Exit_bttn.Location = new System.Drawing.Point(247, 385);
            this.Exit_bttn.Name = "Exit_bttn";
            this.Exit_bttn.Size = new System.Drawing.Size(296, 85);
            this.Exit_bttn.TabIndex = 2;
            this.Exit_bttn.UseVisualStyleBackColor = true;
            // 
            // Name_bx
            // 
            this.Name_bx.Font = new System.Drawing.Font("Tahoma", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.Name_bx.Location = new System.Drawing.Point(292, 304);
            this.Name_bx.Name = "Name_bx";
            this.Name_bx.Size = new System.Drawing.Size(249, 40);
            this.Name_bx.TabIndex = 0;
            // 
            // startGame_bttn
            // 
            this.startGame_bttn.FlatAppearance.BorderSize = 0;
            this.startGame_bttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.startGame_bttn.Image = global::Game.Properties.Resources.begin_button;
            this.startGame_bttn.Location = new System.Drawing.Point(328, 358);
            this.startGame_bttn.Name = "startGame_bttn";
            this.startGame_bttn.Size = new System.Drawing.Size(173, 59);
            this.startGame_bttn.TabIndex = 1;
            this.startGame_bttn.UseVisualStyleBackColor = true;
            this.startGame_bttn.Click += new EventHandler(startGame_bttn_Click);

            // 
            // settingsSave_bttn
            // 
            this.settingsSave_bttn.FlatAppearance.BorderSize = 0;
            this.settingsSave_bttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.settingsSave_bttn.Image = global::Game.Properties.Resources.save_settings_button;
            this.settingsSave_bttn.Location = new System.Drawing.Point(590, 233);
            this.settingsSave_bttn.Name = "settingsSave_bttn";
            this.settingsSave_bttn.Size = new System.Drawing.Size(170, 76);
            this.settingsSave_bttn.TabIndex = 0;
            this.settingsSave_bttn.UseVisualStyleBackColor = true;

            // 
            // settingsCancel_bttn
            // 
            this.settingsCancel_bttn.FlatAppearance.BorderSize = 0;
            this.settingsCancel_bttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.settingsCancel_bttn.Image = global::Game.Properties.Resources.cancel_settings_button;
            this.settingsCancel_bttn.Location = new System.Drawing.Point(586, 312);
            this.settingsCancel_bttn.Name = "settingsCancel_bttn";
            this.settingsCancel_bttn.Size = new System.Drawing.Size(175, 76);
            this.settingsCancel_bttn.TabIndex = 1;
            this.settingsCancel_bttn.UseVisualStyleBackColor = true;
            // 
            // settingsDifficulty_img
            // 
            this.settingsDifficulty_img.Image = global::Game.Properties.Resources.settings_difficulty_easy;
            this.settingsDifficulty_img.Location = new System.Drawing.Point(322, 239);
            this.settingsDifficulty_img.Name = "settingsDifficulty_img";
            this.settingsDifficulty_img.Size = new System.Drawing.Size(191, 75);
            this.settingsDifficulty_img.TabIndex = 2;
            this.settingsDifficulty_img.TabStop = false;
            // 
            // settingsDifficulty_lbttn
            // 
            this.settingsDifficulty_lbttn.FlatAppearance.BorderSize = 0;
            this.settingsDifficulty_lbttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.settingsDifficulty_lbttn.Image = global::Game.Properties.Resources.settings_difficulty_left_button;
            this.settingsDifficulty_lbttn.Location = new System.Drawing.Point(509, 239);
            this.settingsDifficulty_lbttn.Name = "settingsDifficulty_lbttn";
            this.settingsDifficulty_lbttn.Size = new System.Drawing.Size(66, 74);
            this.settingsDifficulty_lbttn.TabIndex = 3;
            this.settingsDifficulty_lbttn.UseVisualStyleBackColor = true;
            // 
            // settingsDifficulty_rbttn
            // 
            this.settingsDifficulty_rbttn.FlatAppearance.BorderSize = 0;
            this.settingsDifficulty_rbttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.settingsDifficulty_rbttn.Image = global::Game.Properties.Resources.settings_difficulty_right_button;
            this.settingsDifficulty_rbttn.Location = new System.Drawing.Point(259, 239);
            this.settingsDifficulty_rbttn.Name = "settingsDifficulty_rbttn";
            this.settingsDifficulty_rbttn.Size = new System.Drawing.Size(66, 74);
            this.settingsDifficulty_rbttn.TabIndex = 4;
            this.settingsDifficulty_rbttn.UseVisualStyleBackColor = true;
            // 
            // settingsGraphic_rbttn
            // 
            this.settingsGraphic_rbttn.FlatAppearance.BorderSize = 0;
            this.settingsGraphic_rbttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.settingsGraphic_rbttn.Image = global::Game.Properties.Resources.settings_graphic_right_button;
            this.settingsGraphic_rbttn.Location = new System.Drawing.Point(259, 317);
            this.settingsGraphic_rbttn.Name = "settingsGraphic_rbttn";
            this.settingsGraphic_rbttn.Size = new System.Drawing.Size(66, 74);
            this.settingsGraphic_rbttn.TabIndex = 5;
            this.settingsGraphic_rbttn.UseVisualStyleBackColor = true;
            // 
            // settingsGraphic_lbttn
            // 
            this.settingsGraphic_lbttn.FlatAppearance.BorderSize = 0;
            this.settingsGraphic_lbttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.settingsGraphic_lbttn.Image = global::Game.Properties.Resources.settings_graphic_left_button;
            this.settingsGraphic_lbttn.Location = new System.Drawing.Point(507, 316);
            this.settingsGraphic_lbttn.Name = "settingsGraphic_lbttn";
            this.settingsGraphic_lbttn.Size = new System.Drawing.Size(66, 74);
            this.settingsGraphic_lbttn.TabIndex = 6;
            this.settingsGraphic_lbttn.UseVisualStyleBackColor = true;
            // 
            // settingsSound_rbttn
            // 
            this.settingsSound_rbttn.FlatAppearance.BorderSize = 0;
            this.settingsSound_rbttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.settingsSound_rbttn.Image = global::Game.Properties.Resources.settings_sound_right_button;
            this.settingsSound_rbttn.Location = new System.Drawing.Point(259, 397);
            this.settingsSound_rbttn.Name = "settingsSound_rbttn";
            this.settingsSound_rbttn.Size = new System.Drawing.Size(66, 74);
            this.settingsSound_rbttn.TabIndex = 7;
            this.settingsSound_rbttn.UseVisualStyleBackColor = true;
            // 
            // settingsSound_lbttn
            // 
            this.settingsSound_lbttn.FlatAppearance.BorderSize = 0;
            this.settingsSound_lbttn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.settingsSound_lbttn.Image = global::Game.Properties.Resources.settings_sound_left_button;
            this.settingsSound_lbttn.Location = new System.Drawing.Point(509, 397);
            this.settingsSound_lbttn.Name = "settingsSound_lbttn";
            this.settingsSound_lbttn.Size = new System.Drawing.Size(66, 74);
            this.settingsSound_lbttn.TabIndex = 8;
            this.settingsSound_lbttn.UseVisualStyleBackColor = true;
            // 
            // settingsGraphic_img
            // 
            this.settingsGraphic_img.Image = global::Game.Properties.Resources.settings_graphics_low;
            this.settingsGraphic_img.Location = new System.Drawing.Point(322, 316);
            this.settingsGraphic_img.Name = "settingsGraphic_img";
            this.settingsGraphic_img.Size = new System.Drawing.Size(188, 74);
            this.settingsGraphic_img.TabIndex = 9;
            this.settingsGraphic_img.TabStop = false;
            // 
            // settingsSound_img
            // 
            this.settingsSound_img.Image = global::Game.Properties.Resources.settings_sound_off;
            this.settingsSound_img.Location = new System.Drawing.Point(323, 394);
            this.settingsSound_img.Name = "settingsSound_img";
            this.settingsSound_img.Size = new System.Drawing.Size(188, 74);
            this.settingsSound_img.TabIndex = 10;
            this.settingsSound_img.TabStop = false;
            this.ResumeLayout(false);

            // 
            // info
            // 
            this.info.AutoSize = true;
            this.info.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(197)))), ((int)(((byte)(34)))), ((int)(((byte)(151)))));
            this.info.Font = new System.Drawing.Font("Tahoma", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.info.ForeColor = System.Drawing.Color.DimGray;
            this.info.Image = global::Game.Properties.Resources.info;
            this.info.Location = new System.Drawing.Point(467, 31);
            this.info.Margin = new System.Windows.Forms.Padding(0);
            this.info.MinimumSize = new System.Drawing.Size(309, 177);
            this.info.Name = "info";
            this.info.Padding = new System.Windows.Forms.Padding(9);
            this.info.Size = new System.Drawing.Size(309, 177);
            this.info.TabIndex = 2;
            this.info.Text = "test";

            // 
            // ball
            // 
            this.ball.Image = global::Game.Properties.Resources.ball;
            this.ball.Location = new System.Drawing.Point(30, 30);
            this.ball.Name = "ball";
            this.ball.Size = new System.Drawing.Size(25, 25);
            this.ball.TabIndex = 1;
            this.ball.TabStop = false;
            // 
            // heart3
            // 
            this.heart3.BackColor = System.Drawing.Color.White;
            this.heart3.Image = global::Game.Properties.Resources.heart;
            this.heart3.Location = new System.Drawing.Point(559, 165);
            this.heart3.Name = "heart3";
            this.heart3.Size = new System.Drawing.Size(37, 38);
            this.heart3.TabIndex = 4;
            this.heart3.TabStop = false;
            // 
            // heart2
            // 
            this.heart2.BackColor = System.Drawing.Color.White;
            this.heart2.Image = global::Game.Properties.Resources.heart;
            this.heart2.Location = new System.Drawing.Point(516, 165);
            this.heart2.Name = "heart2";
            this.heart2.Size = new System.Drawing.Size(37, 38);
            this.heart2.TabIndex = 3;
            this.heart2.TabStop = false;
            // 
            // heart1
            // 
            this.heart1.BackColor = System.Drawing.Color.White;
            this.heart1.Image = global::Game.Properties.Resources.heart;
            this.heart1.Location = new System.Drawing.Point(473, 165);
            this.heart1.Name = "heart1";
            this.heart1.Size = new System.Drawing.Size(37, 38);
            this.heart1.TabIndex = 2;
            this.heart1.TabStop = false;
            // 
            // heart4
            // 
            this.heart4.BackColor = System.Drawing.Color.White;
            this.heart4.Image = global::Game.Properties.Resources.heart;
            this.heart4.Location = new System.Drawing.Point(602, 165);
            this.heart4.Name = "heart4";
            this.heart4.Size = new System.Drawing.Size(37, 38);
            this.heart4.TabIndex = 10;
            this.heart4.TabStop = false;
            // 
            // heart5
            // 
            this.heart5.BackColor = System.Drawing.Color.White;
            this.heart5.Image = global::Game.Properties.Resources.heart;
            this.heart5.Location = new System.Drawing.Point(645, 165);
            this.heart5.Name = "heart5";
            this.heart5.Size = new System.Drawing.Size(37, 38);
            this.heart5.TabIndex = 11;
            this.heart5.TabStop = false;
            // 
            // heart6
            // 
            this.heart6.BackColor = System.Drawing.Color.White;
            this.heart6.Image = global::Game.Properties.Resources.heart;
            this.heart6.Location = new System.Drawing.Point(688, 165);
            this.heart6.Name = "heart6";
            this.heart6.Size = new System.Drawing.Size(37, 38);
            this.heart6.TabIndex = 12;
            this.heart6.TabStop = false;
            // 
            // heart7
            // 
            this.heart7.BackColor = System.Drawing.Color.White;
            this.heart7.Image = global::Game.Properties.Resources.heart;
            this.heart7.Location = new System.Drawing.Point(731, 165);
            this.heart7.Name = "heart7";
            this.heart7.Size = new System.Drawing.Size(37, 38);
            this.heart7.TabIndex = 13;
            this.heart7.TabStop = false;

            // 
            // addTime
            // 
            this.addTime.Tick += new System.EventHandler(this.addTime_Tick);
            // 
            // checkGameOver
            // 
            this.checkGameOver.Tick += new System.EventHandler(this.checkGameOver_Tick);
            // 
            // updateInfo
            // 
            this.updateInfo.Tick += new System.EventHandler(this.updateInfo_Tick);
            // 

            // 
            // moveHunters
            // 
            this.moveHunters.Tick += new System.EventHandler(this.moveHunters_Tick);
            this.moveHunters.Interval = 190;
        }


        private void crt_Labirint()
        {
            this.x = 30; // координата x по умолчанию
            this.y = 30; // координата y по умолчанию
            for (int i = 0; i < 16; i++)
            {
                for (int n = 0; n < 16; n++)
                {
                    this.lab[i, n] = new PictureBox(); // создаём экземпляр класса picturebox
                    this.lab[i, n].Image = global::Game.Properties.Resources._1_0; // по умолчанию задаём ему пустую иконку (0 в лабиринте)
                    this.lab[i, n].Location = new System.Drawing.Point((int)this.x, (int)this.y); // задаём координаты
                    this.lab[i, n].Size = new System.Drawing.Size(25, 25); // задаём размер
                    this.lab[i, n].TabStop = false;
                    this.Controls.Add(this.lab[i, n]); // добавляем экземпляр класса на форму
                    this.x = this.x + this.width; // необходимо для следующего шага цикла
                }

                this.y = this.y + this.width; // необходимо для следующего шага цикла
                this.x = 30; // возвращаем к умолчанию координату x
            }
        }
        private void crt_Hunters()
        {
            Random rand = new Random();
            int num = rand.Next(4, 10);
            int x, y;
            this.hunters = new Hunter[num];
            this.p_hunter = new PictureBox[num];
            for (int i = 0; i < num; i++)
            {
                x = 30 + rand.Next(i, 14) * 25; y = 30 + rand.Next(i, 14) * 25;
                this.p_hunter[i] = new PictureBox(); // создаём экземпляр класса picturebox
                this.hunters[i] = new Hunter(x,y);
                this.hunters[i].PropX = x;
                this.hunters[i].PropY = y;
                this.p_hunter[i].Image = global::Game.Properties.Resources.super_ball; // задаем изображение охотнику
                this.p_hunter[i].Location = new System.Drawing.Point(x, y); // задаём координаты
                this.p_hunter[i].Size = new System.Drawing.Size(25, 25); // задаём размер
                this.p_hunter[i].TabStop = false;
                this.Controls.Add(this.p_hunter[i]); // добавляем экземпляр класса на форму
            }
            this.drw_Hunters();
        }
        private void startGame()
        {
            this.ClientSize = new System.Drawing.Size(800, 502); // задание размера окна (подстраховка)
            this.BackgroundImage = global::Game.Properties.Resources.game_bg;
            this.updateInfo.Start(); // начало таймера обновления информации
            this.checkGameOver.Start(); // начало таймера проверки окончания игры
            this.addTime.Start(); // начало таймера добавления времени
            this.player = new Player(); // создание экзампляра класса игрока
            if (this.difficulty == 1)
            {
                this.lives = 7;
            }
            if (this.difficulty == 2)
            {
                this.lives = 5;
            }
            if (this.difficulty == 3)
            {
                this.lives = 3;
            }
            this.player.setLives(this.lives);
            this.lb = new Labirinth(1); // создание экземпляра класса лабиринта
            //this.lb.changeLevel(2);
            this.Controls.Clear(); // очистка формы игры
            this.crt_Hunters(); // создание охотников
            this.Controls.Add(this.ball);// добавляем игрока 
            this.Controls.Add(this.heart7); // значок жизни (7)
            this.Controls.Add(this.heart6); // значок жизни (6)
            this.Controls.Add(this.heart5); // значок жизни (5)
            this.Controls.Add(this.heart4); // значок жизни (4)
            this.Controls.Add(this.heart3); // значок жизни (3)
            this.Controls.Add(this.heart2); // значок жизни (2)
            this.Controls.Add(this.heart1); // значок жизни (1)
            this.Controls.Add(this.info);
            this.level = 1; // начальный уровень
            this.drw_Player(); // "перерисовка" игрока
            this.crt_Labirint();
            this.drw_Labirint();
            this.player_name = this.Name_bx.Text; // задаём переменной значение поля "имя игрока"
            this.moveHunters.Start();
        }
        private void stopGame()
        {
            this.checkGameOver.Stop();
            this.addTime.Stop();
            this.game_over = true;
            for (int i = 0; i < 16; i++)
            {
                for (int n = 0; n < 16; n++)
                {
                    this.lab[i, n].Visible = false;
                }
            }
            this.ball.Visible = false;
        }
        private void continueGame()
        {
            this.game_over = false;
            this.checkGameOver.Start();
            this.addTime.Start();
            for (int i = 0; i < 16; i++)
            {
                for (int n = 0; n < 16; n++)
                {
                    this.lab[i, n].Visible = true;
                }
            }
            this.ball.Visible = true;
        }
        private void drw_Hunters()
        {
            System.Drawing.Size sz;
            int m, n;
            if (!this.game_over)
            {
                for (int i = 0; i < this.hunters.Length; i++)
                {
                    this.p_hunter[i].Location = new System.Drawing.Point(this.hunters[i].PropX, this.hunters[i].PropY); // задаем позицию игроку (на форме)
                    sz = this.hunters[i].getMatrixPosition(); // получаем позицию охотника в матрице лабиринта (например 0,0)
                    m = sz.Width; // позиция по горизонтали
                    n = sz.Height; // позиция по вертикали
                    this.chng_HuntersBg(m, n, ref this.p_hunter, i); // задаём фон для игрока
                }
            }
        }
        private void drw_Labirint()
        {
            this.x = 30; // координата x по умолчанию
            this.y = 30; // координата y по умолчанию
            for (int i = 0; i < 16; i++)
            {
                for (int n = 0; n < 16; n++)
                {
                    this.chng_PartOfLabirint(i, n); // обновляем елемент массива picturebox`ов
                    this.x = this.x + this.width; // необходимо для слудующего шага цикла
                }

                this.y = this.y + this.width; // необходимо для слудующего шага цикла
                this.x = 30; // возвращаем координату x к умолчанию
            }
        }
        private void drw_Player()
        {
            if (!this.game_over)
            {
                this.ball.Location = new System.Drawing.Point(this.player.PropX, this.player.PropY); // задаем позицию игроку (на форме)
                System.Drawing.Size sz = this.player.getMatrixPosition(); // получаем позицию игрока в матрице лабиринта (например 0,0)
                int i = sz.Width; // позиция по горизонтали
                int n = sz.Height; // позиция по вертикали
                this.chng_PlayerBg(i, n); // задаём фон для игрока
            }
        }
        private void drw_Lives()
        {
            if (this.player.PropLives == 7)
            {
                this.heart1.Visible = true;
                this.heart2.Visible = true;
                this.heart3.Visible = true;
                this.heart4.Visible = true;
                this.heart5.Visible = true;
                this.heart6.Visible = true;
                this.heart7.Visible = true;
            }
            if (this.player.PropLives == 6)
            {
                this.heart1.Visible = true;
                this.heart2.Visible = true;
                this.heart3.Visible = true;
                this.heart4.Visible = true;
                this.heart5.Visible = true;
                this.heart6.Visible = true;
                this.heart7.Visible = false;
            }
            if (this.player.PropLives == 5)
            {
                this.heart1.Visible = true;
                this.heart2.Visible = true;
                this.heart3.Visible = true;
                this.heart4.Visible = true;
                this.heart5.Visible = true;
                this.heart6.Visible = false;
                this.heart7.Visible = false;
            }
            if (this.player.PropLives == 4)
            {
                this.heart1.Visible = true;
                this.heart2.Visible = true;
                this.heart3.Visible = true;
                this.heart4.Visible = true;
                this.heart5.Visible = false;
                this.heart6.Visible = false;
                this.heart7.Visible = false;
            }
            if (this.player.PropLives == 3)
            {
                this.heart1.Visible = true;
                this.heart2.Visible = true;
                this.heart3.Visible = true;
                this.heart4.Visible = false;
                this.heart5.Visible = false;
                this.heart6.Visible = false;
                this.heart7.Visible = false;
            }
            if (this.player.PropLives == 2)
            {
                this.heart1.Visible = true;
                this.heart2.Visible = true;
                this.heart3.Visible = false;
                this.heart4.Visible = false;
                this.heart5.Visible = false;
                this.heart6.Visible = false;
                this.heart7.Visible = false;
            }
            if (this.player.PropLives == 1)
            {
                this.heart1.Visible = true;
                this.heart2.Visible = false;
                this.heart3.Visible = false;
                this.heart4.Visible = false;
                this.heart5.Visible = false;
                this.heart6.Visible = false;
                this.heart7.Visible = false;
            }
            if (this.player.PropLives == 0)
            {
                this.heart1.Visible = false;
                this.heart2.Visible = false;
                this.heart3.Visible = false;
                this.heart4.Visible = false;
                this.heart5.Visible = false;
                this.heart6.Visible = false;
                this.heart7.Visible = false;
            }
        }
        private void chng_HuntersBg(int i, int n, ref PictureBox[] hunters, int p)
        {
            if (this.lb.lab[i, n] == 1)
                hunters[p].BackgroundImage = this.lb.img_1;
            if (this.lb.lab[i, n] == 0)
                hunters[p].BackgroundImage = this.lb.img_0;
            if (this.lb.lab[i, n] == 2)
                hunters[p].BackgroundImage = this.lb.img_2;
            if (this.lb.lab[i, n] == 3)
                hunters[p].BackgroundImage = this.lb.img_3;
            if (this.lb.lab[i, n] == 4)
                hunters[p].BackgroundImage = this.lb.img_4;
            if (this.lb.lab[i, n] == 5)
                hunters[p].BackgroundImage = this.lb.img_5;
            if (this.lb.lab[i, n] == 6)
                hunters[p].BackgroundImage = this.lb.img_6;
            if (this.lb.lab[i, n] == 7)
                hunters[p].BackgroundImage = this.lb.img_7;
            if (this.lb.lab[i, n] == 8)
                hunters[p].BackgroundImage = this.lb.img_8;
            if (this.lb.lab[i, n] == 9)
                hunters[p].BackgroundImage = this.lb.img_9;
            if (this.lb.lab[i, n] == 10)
                hunters[p].BackgroundImage = this.lb.img_10;
            if (this.lb.lab[i, n] == 11)
                hunters[p].BackgroundImage = this.lb.img_11;
            if (this.lb.lab[i, n] == 12)
                hunters[p].BackgroundImage = this.lb.img_12;
        }
        private void chng_PartOfLabirint(int i, int n)
        {
            if (this.lb.lab[i, n] == 1)
                this.lab[i, n].Image = this.lb.img_1;
            if (this.lb.lab[i, n] == 0)
                this.lab[i, n].Image = this.lb.img_0;
            if (this.lb.lab[i, n] == 2)
                this.lab[i, n].Image = this.lb.img_2;
            if (this.lb.lab[i, n] == 3)
                this.lab[i, n].Image = this.lb.img_3;
            if (this.lb.lab[i, n] == 4)
                this.lab[i, n].Image = this.lb.img_4;
            if (this.lb.lab[i, n] == 5)
                this.lab[i, n].Image = this.lb.img_5;
            if (this.lb.lab[i, n] == 6)
                this.lab[i, n].Image = this.lb.img_6;
            if (this.lb.lab[i, n] == 7)
                this.lab[i, n].Image = this.lb.img_7;
            if (this.lb.lab[i, n] == 8)
                this.lab[i, n].Image = this.lb.img_8;
            if (this.lb.lab[i, n] == 9)
                this.lab[i, n].Image = this.lb.img_9;
            if (this.lb.lab[i, n] == 10)
                this.lab[i, n].Image = this.lb.img_10;
            if (this.lb.lab[i, n] == 11)
                this.lab[i, n].Image = this.lb.img_11;
            if (this.lb.lab[i, n] == 12)
                this.lab[i, n].Image = this.lb.img_12;
        }
        private void chng_PlayerBg(int i, int n)
        {
        if (this.lb.lab[i, n] == 1)
                this.ball.BackgroundImage = this.lb.img_1;
            if (this.lb.lab[i, n] == 0)
                this.ball.BackgroundImage = this.lb.img_0;
            if (this.lb.lab[i, n] == 2)
                this.ball.BackgroundImage = this.lb.img_2;
            if (this.lb.lab[i, n] == 3)
                this.ball.BackgroundImage = this.lb.img_3;
            if (this.lb.lab[i, n] == 4)
                this.ball.BackgroundImage = this.lb.img_4;
            if (this.lb.lab[i, n] == 5)
                this.ball.BackgroundImage = this.lb.img_5;
            if (this.lb.lab[i, n] == 6)
                this.ball.BackgroundImage = this.lb.img_6;
            if (this.lb.lab[i, n] == 7)
                this.ball.BackgroundImage = this.lb.img_7;
            if (this.lb.lab[i, n] == 8)
                this.ball.BackgroundImage = this.lb.img_8;
            if (this.lb.lab[i, n] == 9)
                this.ball.BackgroundImage = this.lb.img_9;
            if (this.lb.lab[i, n] == 10)
                this.ball.BackgroundImage = this.lb.img_10;
            if (this.lb.lab[i, n] == 11)
                this.ball.BackgroundImage = this.lb.img_11;
            if (this.lb.lab[i, n] == 12)
                this.ball.BackgroundImage = this.lb.img_12;
        }
        private void gameOver()
        {
            this.addTime.Stop(); // останавливаем таймер
            this.checkGameOver.Stop(); //останавливаем таймер
            //this.fone.Stop();
            this.playFail();

            //System.Windows.Forms.MessageBox.Show("КОНЕЦ ИГРЫ :)\nОжидайте продолжения;) \nКол-во уровней: 6", "Конец Игры ;)");
            this.game_over = true;
            if (this.player.PropLives == 0)
            {
                DialogResult dr2 = MessageBox.Show("Вы уверены, что начать игру заново ?",
                "Начать заново",
                MessageBoxButtons.YesNoCancel,
                MessageBoxIcon.Question,
                MessageBoxDefaultButton.Button2);
                if (dr2 == DialogResult.Yes)
                {
                    this.game_over = false;
                    this.startGame();
                    //this.fone.Play();
                }
            }
            else
            {
                DialogResult dr2 = MessageBox.Show("Вы Победили, не Желаете ли начать игру заново ?",
                "Победа! Начать заново?",
                MessageBoxButtons.YesNoCancel,
                MessageBoxIcon.Question,
                MessageBoxDefaultButton.Button2);
                if (dr2 == DialogResult.Yes)
                {
                    this.game_over = false;
                    this.startGame();
                    //this.fone.Play();
                }
            }
            // вывод MessageBox`а
        }
        private void moveHunter(int i)
        {
        System.Random random = new Random();
             int rand;
             rand = random.Next(0,4);
             if (rand == 1)
             {
                 this.hunters[i].moveRight(ref this.lb);
             }
             if (rand == 2)
             {
                 this.hunters[i].moveUp(ref this.lb);
             }
             if (rand == 3)
             {
                 this.hunters[i].moveLeft(ref this.lb);
             }
             if (rand == 4)
             {
                 this.hunters[i].moveDown(ref this.lb);
             }
        }
        public void playKill()
        {
            System.Media.SoundPlayer s_player = new System.Media.SoundPlayer(global::Game.Properties.Resources.pig);
            s_player.Play();
        }
        public void playFail()
        {
            //string path = Application.StartupPath + @"\res\fail.mp3";
            //Audio fail = new Audio(path);
            //fail.Play();
        }
        public void TryToKill(int i)
        {
            Size hunter_position = this.hunters[i].getMatrixPosition();
            Size player_position = this.player.getMatrixPosition();
            if (hunter_position.Height == player_position.Height && hunter_position.Width == player_position.Width)
            {
                this.hunters[i].KillPlayer(ref this.player);
                this.playKill();
                this.drw_Player();
            }
            if (hunter_position.Height == player_position.Height && player_position.Width == hunter_position.Width + 1)
            {
                if (this.hunters[i].checkMoveUp(ref this.lb))
                {
                    this.hunters[i].KillPlayer(ref this.player);
                    this.playKill();
                    this.drw_Player();
                }
            }
            if (hunter_position.Height == player_position.Height && player_position.Width == hunter_position.Width - 1)
            {
                if (this.hunters[i].checkMoveDown(ref this.lb))
                {
                    this.hunters[i].KillPlayer(ref this.player);
                    this.playKill();
                    this.drw_Player();
                }
            }
            if (player_position.Height == hunter_position.Height + 1 && hunter_position.Width == player_position.Width)
            {
                if (this.hunters[i].checkMoveRight(ref this.lb))
                {
                    this.hunters[i].KillPlayer(ref this.player);
                    this.playKill();
                    this.drw_Player();
                }
            }
            if (player_position.Height == hunter_position.Height - 1 && hunter_position.Width == player_position.Width)
            {
                if (this.hunters[i].checkMoveLeft(ref this.lb))
                {
                    this.hunters[i].KillPlayer(ref this.player);
                    this.playKill();
                    this.drw_Player();
                }
            }
        }
    }
}
